function Exit66Scroller(className) {
    this._className = className;
    
    this._element = null;
    this._contentBox = null;
        
    this._currentX = 0;
    this._currentY = 0;
    
    this._velX = 0;
    this._velY = 2;
    
    this._timeStep = 50;
    this._pauseSteps = 15;
    this._pauseBlankSteps = 15;
    this._pause = 0;
    
    this._emptyScrollCount = 10;
    
    
    this._init();
}

Exit66Scroller.prototype._init = function(className) {
    var box = document.createElement('div');
    box.className = this._className;
    box.style.overflow = 'hidden'; 
    
    var content = document.createElement('div');
    content.className = 'content';
    content.minHeight = '5px';
    content.style.position = 'relative';
    box.appendChild(content);
    
    this._element = box;
    this._contentBox = content;
        
    this.emptyWait = this._emptyScrollCount;
    
    this._processScroll();
}

Exit66Scroller.prototype.onScrollComplete = function() {}

Exit66Scroller.prototype._processScroll = function() {
    var oThis = this;
    var mainDiv = this._element;
    var subDiv = this._contentBox;
    var timeOut = this._timeStep;
    
    var waitAtTop;
    if (subDiv.offsetHeight <= mainDiv.offsetHeight) {
        waitAtTop = true;
    }

    if ((subDiv.offsetHeight != 0) && (!waitAtTop || this._currentY != 0)) {
        if (this._pause <= 0) {
            
            if ((this._currentY - this._velY <= 0) && 
                (this._currentY > 0)) {
                if (waitAtTop) {
                    this._currentY = 0;
                }
                else {
                    this._pause = this._pauseSteps;
                    this._currentY = this._currentY - this._velY;
                }
            }
            else {
                this._currentY = this._currentY - this._velY;
            }
            
            if (this._currentY <= (subDiv.offsetHeight * -1)) {
                this._pause = this._pauseBlankSteps;
                this.onScrollComplete();
                this._currentY = mainDiv.offsetHeight;
            } 
            subDiv.style.top = this._currentY;
        }
        else {
            this._pause = this._pause - 1;
        }
    }
    else {
        if (this.emptyWait == 0) {
            this.onScrollComplete();
            this.emptyWait = this._emptyScrollCount;
        }
        else {
            this.emptyWait = this.emptyWait - 1;
        }
        timeOut = 1000;
    }
    
    var f = function() {
        oThis._processScroll();
    }
    
    setTimeout(f, timeOut);
}

Exit66Scroller.prototype.addToParent = function(parent) {
    parent.appendChild(this._element);
}

Exit66Scroller.prototype.addToContent = function(content) {
    this._contentBox.appendChild(content);
}

Exit66Scroller.prototype.getContentBox = function() {
    return this._contentBox;
}

Exit66Scroller.prototype.getElement = function() {
    return this._element;
}